﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GoodMan.Infrastructure.Entities.Repository;

namespace GoodMan.Infrastructure.Entities.Entity
{
    public class ProductRepertoryHistory : IAccessible<T_ProductRepertoryHistory, ProductRepertoryHistory>, ILogicEntity<T_ProductRepertoryHistory, ProductRepertoryHistory>
    {
        public int Id { get; set; }
        public int ProductId { get; set; }
        public string ProductName { get; set; }
        public int CollegeId { get; set; }
        public int DormitoryId { get; set; }
        public int PutNum { get; set; }
        public DateTime PutDate { get; set; }
        public string UserName { get; set; }


        protected override void Covariant(T_ProductRepertoryHistory model)
        {
            if (model != null)
            {
                this.CollegeId = model.CollegeId;
                this.DormitoryId = model.DormitoryId;
                this.Id = model.Id;
                this.ProductId = model.ProductId;
                this.ProductName = model.ProductName;
                this.PutDate = model.PutDate;
                this.PutNum = model.PutNum;
                this.UserName = model.UserName;
            }
        }

        protected override T_ProductRepertoryHistory Inverter(ProductRepertoryHistory model)
        {
            if (model != null)
            {
                return new T_ProductRepertoryHistory()
                {
                    CollegeId = model.CollegeId,
                    DormitoryId = model.DormitoryId,
                    Id = model.Id,
                    ProductId = model.ProductId,
                    ProductName = model.ProductName,
                    PutDate = model.PutDate,
                    PutNum = model.PutNum,
                    UserName = model.UserName
                };
            }
            return null;
        }

        public ProductRepertoryHistory Set(T_ProductRepertoryHistory dbModel)
        {
            Covariant(dbModel);
            return this;
        }
    }
}
